/**
 * 
 */
package mdb.com.vn.web.view;

import java.io.Serializable;
import java.util.List;

import javax.faces.model.ListDataModel;

import mdb.com.vn.model.Loans;

import org.primefaces.model.SelectableDataModel;

/**
 * @author tu.dod
 * 
 */
public class LoansDataModel extends ListDataModel<Loans> implements
		SelectableDataModel<Loans>, Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public LoansDataModel() {
	}
	public LoansDataModel(List<Loans> loansData) {
		super(loansData);
	}

	@SuppressWarnings("unchecked")
	@Override
	public Loans getRowData(String rowKey) {
		// TODO Auto-generated method stub
		List<Loans> loans = (List<Loans>) getWrappedData();
		for (Loans loans2 : loans) {
			if (loans2.getRefNo().equals(rowKey)){
				return loans2;
			}
		}
		return null;
	}

	@Override
	public Object getRowKey(Loans loans) {
		// TODO Auto-generated method stub
		return loans.getRefNo();
	}

}
